#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: method.py
# Description: 
#   1. PEP 3114 -- Renaming iterator.next() to iterator.__next__()
# Edit History: 
#   2011-11-01    File created.
#===============================================================================

#===============================================================================
#   1. PEP 3114 -- Renaming iterator.next() to iterator.__next__()
#===============================================================================
x = [1,2,3]
print(x[1])
print(x.__getitem__(1))

print(len(x))
print(x.__len__())

print(iter(x))
print(x.__iter__())



x = 5
print(x + 1)
print(x.__add__(1))

print(-x)
print(x.__neg__())


print(hash(x))
print(x.__hash__())


def chain(*iterables):
    # chain('ABC', 'DEF') --> A B C D E F
    for it in iterables:
        for element in it:
            yield element
x = chain('AB', 'CD')
print(next(x))
print(x.__next__())
